<template>
  <div class="module2">
    <el-carousel class="carousel" :interval="5000" arrow="never">
      <el-carousel-item v-for="(item, index) in list" :key="index">
        <img class="img-view" :src="item" />
      </el-carousel-item>
    </el-carousel>
  </div>
</template>
<script setup>
import { ref, watch, toRaw } from 'vue'

const props = defineProps({
  data: {
    type: Array,
    default: () => []
  }
})

const list = ref([])

watch(
  () => props.data,
  (newValue) => {
    const _newValue = toRaw(newValue)
    list.value = _newValue
  },
  {
    immediate: true
  }
)
</script>
<style lang="scss" scoped>
.module2 {
  width: 100%;
  height: 100%;
  padding: 18px;
  box-sizing: border-box;
  .carousel {
    height: 100%;
    :deep(.el-carousel__container) {
      height: 100%;
    }
    .img-view {
      height: 100%;
      width: 100%;
    }
  }
}
</style>
